package com.guli.sms.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.guli.common.pojo.SeckillSessionEntity;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.guli.common.pojo.vo.SecKillSessionAndRelationVo;

import java.util.List;
import java.util.Map;

/**
 * 秒杀活动场次
 *
 * @author LuoJunHua
 * @email 1007052116@qq.com
 * @date 2020-11-29 10:59:49
 */
public interface SeckillSessionService extends IService<SeckillSessionEntity> {

    Page<SeckillSessionEntity> queryPage(Integer currentPage, Integer size, Map<String, Object> params);

    List<SecKillSessionAndRelationVo> getLatestSecKillSkuByDateInterval(Integer days);

    void saveBatchAndCheckIfNeedToRefreshRedisCache(List<SeckillSessionEntity> seckillSessions);

    /**
     * 以事务的方式批量保存秒杀场次信息
     * @param seckillSessions
     */
    void saveBatchWithTransactional(List<SeckillSessionEntity> seckillSessions);

    void updateBatchByIdAndCheckIfNeedToRefreshRedisCache(List<SeckillSessionEntity> seckillSessions);

    void updateBatchByIdWithTransactional(List<SeckillSessionEntity> seckillSessions);
}

